package com.action;

import com.pojo.Goods;
import com.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Controller
@RequestMapping("/admin/goods")
public class GoodsAction {


    @Autowired
    private GoodsService goodsService;


    @Autowired
    private HttpServletRequest request;

    @RequestMapping("/getAll")
    public String getAll()
    {
        List<Goods> list = goodsService.findAll();

        request.setAttribute("list",list);
        return "/showGoods.jsp";
    }


    @RequestMapping("/saveSeckillGoods")
    public String saveSeckillGoods(Long gid, Integer kuchun, String beginTime, BigDecimal price)
    {
        goodsService.saveSeckillGoods(gid,kuchun,beginTime,price);
        return getAll();
    }


}
